package com.mt.roll.wms.controller;

import com.mt.roll.core.base.BaseController;
import com.mt.roll.core.constants.CommonConstant;
import com.mt.roll.core.params.IdParam;
import com.mt.roll.core.validator.groups.PageGroup;
import com.mt.roll.core.vo.PageVo;
import com.mt.roll.core.vo.R;
import com.mt.roll.wms.params.StorageBoxQueryParam;
import com.mt.roll.wms.service.StorageBoxService;
import com.mt.roll.wms.vo.StorageBoxVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.groups.Default;

/**
 * @auther why
 * @date 2021/10/8 10:21
 */
@RestController
@RequestMapping(CommonConstant.API_MODULE_WMS + "storage/box")
@Slf4j
@Api(value = "存储箱信息", tags = "存储箱信息", hidden = false)
public class StorageBoxController extends BaseController {


    @Autowired
    private StorageBoxService storageBoxService;

    @PostMapping(value = "page/for/bind")
    @ApiOperation(value = "获取分页存储箱上架")
    private R<PageVo<StorageBoxVo>> pageForBind(@Validated({PageGroup.class, Default.class}) @RequestBody StorageBoxQueryParam storageBoxQueryParam) {
        return storageBoxService.pageForBind(storageBoxQueryParam);
    }

    @PostMapping(value = "get")
    @ApiOperation(value = "获取存储箱详情")
    private R<StorageBoxVo> get(@Validated @RequestBody IdParam idParam) {
        return storageBoxService.get(idParam);
    }


}
